<template>
	<view :style="themeColor">
		<view class="page">
			<view
				class="flex align-center benben-position-layout flex offerPay_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }"
			>
				<view class='flex align-center self-center justify-between flex-sub offerPay_fd0_0'>
					<view
						class='flex flex-wrap align-center offerPay_fd0_0_c0'
						@tap.stop="popupShow1679651812141=true"
					>
						<image
							class='offerPay_fd0_0_c0_c0'
							mode="aspectFit"
							:src='STATIC_URL+"347.png"'
						></image>
					</view>
					<view class='flex flex-wrap align-stretch justify-center flex-sub'>
						<text
							class='offerPay_fd0_0_c1_c0'
							style="font-family: Alimama DongFangDaKai, Alimama DongFangDaKai;"
						>收银台</text>
					</view>
					<view class='flex flex-wrap align-center offerPay_fd0_0_c0'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>

			<view class="flex flex-direction flex-wrap align-center benben-flex-layout offerPay_flex_1">
				<view
					class='flex flex-wrap align-end offerPay_fd1_0'
					style="align-items: baseline;"
				>
					<text class='offerPay_fd1_0_c0'>￥</text>
					<text class=' offerPay_fd1_0_c1'>
						<text class=' offerPay_price1_fd1_0_c1'>{{ money | frontPrice }}</text>
						<text class=' offerPay_price2_fd1_0_c1'>{{ money | laterPrice }}</text>
					</text>
				</view>
			</view>


			<!---flex布局flex布局开始-->
			<view class="flex benben-flex-layout flex-wrap align-center offerPay_flex_2">
			</view>

			<!---flex布局flex布局结束-->
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout offerPay_flex_3">
				<text class='offerPay_fd3_0'>勾选支付方式</text>
				<benben-select-diy
					ref="showSelectPopup1687683901811"
					class-name='flex flex-direction flex-wrap align-stretch flex'
					:items.sync="dataType"
					v-model="payID"
					:label.sync="payLable"
					default-type="pay_type"
					default-label="name"
					:allow-cancel='false'
					type="radio"
					:disabled='false'
					v-if="dataType.length!='0'"
				>
					<template v-for='(item,key0) in dataType'>
						<view
							v-if="item.isSelected"
							class='flex align-center flex offerPay_fd3_1_c0'
							:key="key0"
							@tap="$refs.showSelectPopup1687683901811.tapHandle(key0)"
						>
							<image
								class='offerPay_fd3_1_c0_c0'
								mode="aspectFit"
								:src='item.image'
							></image>
							<text class='offerPay_fd3_1_c0_c1'>{{item.name}}</text>
							<view
								class='flex flex-wrap align-center'
								v-if=" item.pay_type=='balance'"
							>
								<text class='offerPay_fd3_1_c0_c1'>(可用余额￥</text>
								<text class='offerPay_fd3_1_c0_c1'>{{dataMessage.user_money}}</text>
								<text class='offerPay_fd3_1_c0_c1'>)</text>
							</view>
							<image
								class='offerPay_fd3_1_c0_c3'
								mode="aspectFit"
								:src='STATIC_URL+"521.png"'
							></image>
						</view>
						<view
							v-else
							class='flex align-center flex offerPay_fd3_1_c0'
							:key="key0"
							@tap="$refs.showSelectPopup1687683901811.tapHandle(key0)"
						>
							<image
								class='offerPay_fd3_1_c0_c0'
								mode="aspectFit"
								:src='item.image'
							></image>
							<text class='offerPay_fd3_1_c0_c1'>{{item.name}}</text>
							<view
								class='flex flex-wrap align-center'
								v-if=" item.pay_type=='balance'"
							>
								<text class='offerPay_fd3_1_c0_c1'>(可用余额￥</text>
								<text class='offerPay_fd3_1_c0_c1'>{{dataMessage.user_money}}</text>
								<text class='offerPay_fd3_1_c0_c1'>)</text>
							</view>
							<image
								class='offerPay_fd3_1_c0_c3'
								mode="aspectFit"
								:src='STATIC_URL+"336.png"'
							></image>
						</view>
					</template></benben-select-diy>
				<button
					class='offerPay_fd3_2'
					style="font-family: Alimama DongFangDaKai;"
					@tap.stop="immediatePaymentFunc()"
				>确认支付</button>
			</view>
			<!---flex布局flex布局开始-->
			<view class="flex benben-flex-layout flex-wrap align-center offerPay_flex_7">
				<image
					class='offerPay_fd7_0'
					mode="aspectFit"
					:src='STATIC_URL+"522.png"'
				></image>
			</view>

			<!---flex布局flex布局结束-->


		</view>
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},


		data() {
			return {
				"popupShow1685686587824": false,
				"popupShow1687342431187": false,
				"popupShow1679651812141": false,
				"payID": "wxpay",
				"payLable": "微信支付",
				"pay_password": "",
				"dataMessage": {
					"invite_code": "",
					"address": "",
					"address_code": "",
					"hobby": "",
					"tags": "",
					"id": "",
					"userlevel_id": "",
					"mobile": "",
					"real_name": "",
					"avatar": "",
					"account": "",
					"email": "",
					"birthday": "",
					"gender": "",
					"create_time": "",
					"user_money": "",
					"freeze_money": "",
					"total_consumption_money": "",
					"score": "",
					"_mobile": "",
					"coupon": "",
					"collection_count": "",
					"browse_count": "",
					"total_money": "",
					"certified": "",
					"nickname": "",
					"is_pay_password": "",
					"follow_count": ""
				},
				"dataType": [{
					image: "https://www.guochaoxiaoju.com/uploads/mini/652.png",
					name: "微信支付",
					pay_type: "wxpay"
				}],
				"typeUrl": {
					"wxpay": "https://zhongben-crm.oss-cn-zhangjiakou.aliyuncs.com/uploads/images/20221201/33830ae4892cd61a91208d43cbc103d3.png",
					"balance": "https://oss.tiantianhuoke.com/images/168371455948373.png",
					"alipay": "https://zhongben-crm.oss-cn-zhangjiakou.aliyuncs.com/uploads/images/20221201/33830ae4892cd61a91208d43cbc103d3.png"
				},
				"shifoupwsd": {
					"falg": ""
				},
				"xianshi": true,
				"datashifoucom": {
					"falg": ""
				},
				"dataDetail": {
					"aid": "",
					"order_sn": "",
					"order_money": "",
					"payable_money": "",
					"coupon_id": "",
					"coupon_money": "",
					"send_time": "",
					"receive_time": "",
					"pay_time": "",
					"discount_money": "",
					"create_time": "",
					"pay_type": "",
					"status": "",
					"pay_type_str": "",
					"order_info": {
						"receiver_mobile": "",
						"receiver_address": "",
						"receiver_name": "",
						"remark": "",
						"province": "",
						"city": "",
						"district": "",
						"sex": "",
						"label_name": "",
						"express_price": "",
						"pickup_code": "",
						"pickup_img": ""
					},
					"order_goods_list": [],
					"shop_info": {
						"aid": "",
						"store_name": "",
						"store_logo": "",
						"store_logo_id": ""
					},
					"btn_list": {
						"cancel_order": "",
						"go_pay": "",
						"remind_send": "",
						"remind_already": "",
						"apply_invoice": "",
						"view_invoice": "",
						"apply_refund": "",
						"view_logistics": "",
						"confirm_receive": "",
						"evaluate": "",
						"delete_order": "",
						"pay_balance": ""
					},
					"is_multiple_package": "",
					"order_type": "",
					"advance_sn": "",
					"usermerchant_id": "",
					"discount_str": "",
					"surplus_receive_time": "",
					"group_info": {
						"join_timeout": "",
						"activity_status": "",
						"group_members_nums": "",
						"join_number": "",
						"status_txt": ""
					},
					"group_user": [],
					"real_money": "",
					"cancel_surplus_second": "",
					"balance_payment_stime": "",
					"balance_payment_etime": "",
					"receive_surplus_time": "",
					"goods_total": "",
					"pay_status": ""
				},
				"integralDetail": {
					"aid": "",
					"user_id": "",
					"order_sn": "",
					"order_type": "",
					"status": "",
					"pay_status": "",
					"payable_money": "",
					"real_money": "",
					"create_time": "",
					"pay_type": "",
					"integral_reduce": "",
					"pay_time": "",
					"cancel_time": "",
					"is_remind": {
						"info": "",
						"hour": ""
					},
					"order_address": {
						"address_id": "",
						"receiver_mobile": "",
						"receiver_address": "",
						"receiver_name": "",
						"remark": "",
						"express_price": "",
						"province": "",
						"city": "",
						"district": "",
						"sex": "",
						"label_name": ""
					},
					"goods_integral": [],
					"goods_money": ""
				},
				"order_sn": "GD20230625191830714165",
				"money": "0",
				"time": "0",
				"order_type": "",
				payLoading: false,
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			let {
				order_sn,
				money,
				time,
			} = options
			if (order_sn !== undefined) this.order_sn = order_sn
			if (money !== undefined) this.money = money
			if (time !== undefined) this.time = time
			// this.getMessageFunc()
			// this.getintegralDetailFunc()
			// this.getTypeFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//返回到订单详情
			returntoOrderDetailsFunc() {
				this.popupShow1679651812141 = false;
				this.$urouter.navigateBack(1);
			},
			//立即支付
			async immediatePaymentFunc() {
				if (this.payLoading) return;
				if (!validate(this.payID, 'require')) {
					this.$message.info('请选择支付方式');
					return false;
				}
				if (this.payID == 'balance') {
					if (this.shifoupwsd.falg == 0) {
						this.popupShow1687342431187 = true;
					} else {
						if (+this.dataMessage.user_money < this.money) {
							this.$message.info('余额不足');
							return
						}
						this.popupShow1685686587824 = true;
					}
				} else if (this.payID == "wxpay") {
					this.payLoading = true;
					try {
						const res = await this.xcxpay(this.order_sn);
						uni.redirectTo({
							url: "/pages/shouye/pay/payResult?order_sn=" + this.order_sn
						});
					} catch (e) {
						console.debug(e, "e")
						this.$msg(e.msg || "失败")
					}
					this.payLoading = false;
				}
			},
			/**
			 * 微信小程序支付
			 * @param String orderNo 订单号
			 */
			xcxpay(orderNo = "") {
				return new Promise(async (resolve, reject) => {
					var api = `/${this.apiFix}/63e1bd15aa877`
					var query = {
						order_sn: orderNo,
						pay_type: "wxpay",
					};
					try {
						var res = await this.$api.post(api, query)
						if (res.data.code == 1) {
							uni.requestPayment({
								...res.data.data,
								provider: 'wxpay',
								success() {
									resolve()
								},
								fail() {
									reject()
								}
							})
						} else reject(res);
					} catch (e) {
						reject(e)
					}
				})
			},

			//获取支付方式
			async getTypeFunc() {
				//请求方法
				//数据验证

				let datadataType = await this.$api.get(global.apiUrls.post64424fe115688, {

				});

				if (datadataType.data.code != 1) {
					this.$message.info(datadataType.data.msg);
					return
				}
				let infodataType = datadataType.data;
				this.dataType = infodataType.data
			},
		}
	};
</script>
<style
	lang="scss"
	scoped
>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: url($imgFix + '684.png') rgba(248, 248, 248, 1);
		background-size: 100% auto;
	}

	.offerPay_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.offerPay_fd0_0_c1_c0 {
		font-size: 40rpx;
		font-weight: 400;
		color: #000000;
		line-height: 88rpx;
	}

	.offerPay_fd0_0_c0_c0 {
		width: 36rpx;
		height: 36rpx;
	}

	.offerPay_fd0_0_c0 {
		width: 100rpx;
		height: 88rpx;
	}

	.offerPay_fd0_0 {
		margin: 0rpx 32rpx 0rpx 32rpx;
	}

	.offerPay_flex_1 {
		background: #fff;
		background-size: 100% auto !important;
	}

	.offerPay_fd1_1_c1 {
		background: #FFFFFF;
	}

	.offerPay_fd1_1_c0 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #666666;
	}

	.offerPay_fd1_1 {
		margin: 0rpx 0rpx 56rpx 0rpx;
	}

	.offerPay_price2_fd1_0_c1 {
		font-size: 28rpx;
	}

	.offerPay_price1_fd1_0_c1 {
		line-height: 36rpx;
		font-size: 48rpx;
		font-weight: 700;
		color: var(--benbenFontColor4);
	}

	.offerPay_fd1_0_c1 {
		color: rgba(173, 56, 35, 1);
		font-weight: 700;
		line-height: 94rpx;
		font-size: 64rpx;
	}

	.offerPay_fd1_0_c0 {
		font-size: 28rpx;
		font-weight: 700;
		color: rgba(173, 56, 35, 1);
		line-height: 100rpx;
	}

	.offerPay_fd1_0 {
		margin: 66rpx 0rpx 24rpx 0rpx;
	}

	.offerPay_flex_2 {
		background: rgba(246, 247, 249, 1);
		height: 20rpx;
		background-size: 100% auto !important;
	}

	.offerPay_flex_3 {
		background: #fff;
		background-size: 100% auto !important;
		padding: 0rpx 32rpx 12rpx 32rpx;
		margin: 0rpx 0rpx 120rpx 0rpx;
	}

	.offerPay_fd3_2 {
		background: var(--benbenbgColor2);
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		font-size: 36rpx;
		color: #fff;
		width: 686rpx;
		height: 80rpx;
		line-height: 80rpx;
		position: fixed;
		bottom: calc(32rpx + var(--window-bottom));
	}

	.offerPay_fd3_1_c0_c3 {
		width: 32rpx;
		height: 32rpx;
		border-radius: 18rpx 18rpx 18rpx 18rpx;
		margin: 0rpx 0rpx 0rpx auto;
	}

	.offerPay_fd3_1_c0_c1 {
		font-size: 32rpx;
		font-weight: 400;
		color: #333333;
		line-height: 45rpx;
	}

	.offerPay_fd3_1_c0_c0 {
		width: 56rpx;
		height: 56rpx;
		border-radius: 26rpx 26rpx 26rpx 26rpx;
		margin: 0rpx 24rpx 0rpx 0rpx;
	}

	.offerPay_fd3_1_c0 {
		padding: 32rpx 0rpx 32rpx 0rpx;
	}

	.offerPay_fd3_0 {
		border-bottom: 1px solid #eee;
		font-size: 28rpx;
		font-weight: 400;
		color: #666666;
		padding: 32rpx 0rpx 32rpx 0rpx;
		line-height: 40rpx;
	}

	.offerPay_flex_4 {
		width: 540rpx;
	}

	.offerPay_fd4_0_c1_c1 {
		background: #fff;
		font-size: 32rpx;
		color: rgba(173, 56, 35, 1);
		border-radius: 0rpx 0rpx 16rpx 0rpx;
		height: 110rpx;
		line-height: 110rpx;
	}

	.offerPay_fd4_0_c1_c0 {
		border-right: 1px solid rgba(238, 238, 238, 1);
		background: #fff;
		font-size: 32rpx;
		color: var(--benbenFontColor2);
		border-radius: 0rpx 0rpx 0rpx 16rpx;
		height: 110rpx;
		line-height: 110rpx;
	}

	.offerPay_fd4_0_c0_c1_c0_c1 {
		background: #FFFFFF;
	}

	.offerPay_fd4_0_c0_c1_c0 {
		text-align: center;
	}

	.offerPay_fd4_0_c0_c0 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 45rpx;
		margin: 0rpx 0rpx 40rpx 0rpx;
	}

	.offerPay_fd4_0_c0 {
		border-bottom: 1px solid rgba(238, 238, 238, 1);
		padding: 40rpx 30rpx 32rpx 30rpx;
		border-radius: 16rpx 16rpx 0rpx 0rpx;
	}

	.offerPay_fd4_0 {
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.offerPay_flex_5 {
		background: #fff;
		width: 540rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.offerPay_fd5_1_c1 {
		border-top: 1px solid #eee;
		border-left: 1px solid #eee;
		background: #fff;
		line-height: 94rpx;
		border-radius: 0rpx 0rpx 16rpx 0rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor5);
		padding: 0rpx 100rpx 0rpx 100rpx;
		font-weight: 500;
	}

	.offerPay_fd5_1_c0 {
		border-top: 1px solid #eee;
		background: #fff;
		line-height: 94rpx;
		border-radius: 0rpx 0rpx 0rpx 16rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor2);
		padding: 0rpx 102rpx 0rpx 103rpx;
		font-weight: 400;
	}

	.offerPay_fd5_0 {
		line-height: 44rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: #333333;
		margin: 91rpx 0rpx 88rpx 0rpx;
	}

	.offerPay_fd6_0_c2_c1 {
		background: #fff;
		border-radius: 0rpx 0rpx 16rpx 0rpx;
		font-size: 33rpx;
		color: var(--benbenFontColor5);
		width: 269rpx;
		font-weight: 500;
		line-height: 94rpx;
	}

	.offerPay_fd6_0_c2_c0 {
		border-right: 1px solid #eee;
		background: #fff;
		border-radius: 0rpx 0rpx 0rpx 16rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor2);
		line-height: 94rpx;
		width: 269rpx;
		font-weight: 400;
	}

	.offerPay_fd6_0_c2 {
		border-top: 1px solid #eee;
	}

	.offerPay_flex_password_noActive_fd6_0_c1 {
		border: 1px solid #ccc;
		width: 68rpx;
		height: 68rpx;
	}

	.offerPay_flex_password_active_fd6_0_c1 {
		border: 1px solid #409EFF;
		width: 68rpx;
		height: 68rpx;
	}

	::v-deep .offerPay_fd6_0_c1 {
		margin: 32rpx 0rpx 32rpx 0rpx;
	}

	.offerPay_fd6_0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: rgba(51, 51, 51, 1);
		margin: 0rpx 0rpx 32rpx 0rpx;
	}

	.offerPay_fd6_0 {
		background: #fff;
		width: 540rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		background-size: 100% auto !important;
		padding: 40rpx 0rpx 0rpx 0rpx;
	}

	.offerPay_flex_7 {
		position: absolute;
		bottom: 117rpx;
		left: 58rpx;
	}

	.offerPay_fd7_0 {
		width: 166rpx;
		height: 175rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}
</style>